from django.urls import path
from rbac.views import LoginAPIView,LoginOutView,ResourceView,RoleView
from rbac.workflowview import WorkFlowAPIView,WorkFlowDetailAPIView,WorkFlowPermissionAPIView,WorkFlowApprovalAPIView,WorkFlowStatusUpdateAPIView,PositionAPIView
from rbac.OAview import UserTaskView, TaskCreateView, AuditWorkflowView,TaskDetailView
urlpatterns = [
    path('login/', LoginAPIView.as_view(), name='rbac-login'),
    path('logout/', LoginOutView.as_view(), name='rbac-logout'),

    # 添加资源
    path('add_res/',ResourceView.as_view(),name='rbac-add-res'),

    # 添加角色
    path('add_role/', RoleView.as_view(), name='rbac-add-role'),

    # 工作流
    path('workflow/', WorkFlowAPIView.as_view(), name='workflow_list_create'),
    path('workflow/<int:workflow_id>/', WorkFlowDetailAPIView.as_view(), name='workflow_detail_update_delete'),
    path('workflow/permissions/', WorkFlowPermissionAPIView.as_view(), name='workflow_permissions'),
    path('workflow/approvals/', WorkFlowApprovalAPIView.as_view(), name='workflow_approvals'),
    path('workflow/<int:workflow_id>/status/', WorkFlowStatusUpdateAPIView.as_view(), name='workflow_status_update'),

    # 职务
    path('position/',PositionAPIView.as_view(),name='position_list_create'),


    # OA
    path('userTask/', UserTaskView.as_view(), name='user-task'),
    path('addtask/', TaskCreateView.as_view(), name='add-task'),
    path('auditWorkflows/', AuditWorkflowView.as_view(), name='audit-workflows'),

    path('task/<int:task_id>/', TaskDetailView.as_view(), name='task-detail'),

]